package org.NooLab.glue.subscription;

import java.util.Vector;

 
import org.NooLab.compare.utilities.math.DistanceControlProperties;
import org.NooLab.glue.subscription.context.Comparison;
import org.NooLab.glue.subscription.context.Context;
import org.NooLab.glue.subscription.context.ContextIntf;

 
public class Future implements FutureIntf{

	
	Vector<FutureProperties> properties = new Vector<FutureProperties>(); 

	DistanceControlProperties distanceCtrl;
	
	String guidStr = "";
	long instanceID = -1;
	 
	
	public Future( DistanceControlProperties distancectrl ){
		
		if (distancectrl != null){
			distanceCtrl = distancectrl;
		}else{
			distanceCtrl = new DistanceControlProperties();
		}
	}
	
	
	public Vector<FutureProperties> getProperties(){
		
		return properties;
	}
	
	
	/**
	 * 
	 */
	public void addProperty( String subscriptLabel, String[] values, String[] exclitemvalues, double minimalmatch ) {
		FutureProperties props ;
		
		props = new FutureProperties();
		 
		props.type = FutureProperties._SIMPLESET ;
		
		props.key  = "keywords";
		props.name = subscriptLabel;
		
		props.values = values;
		props.exclvalues = exclitemvalues;
		props.minimalMatch = minimalmatch;
		properties.add(props) ;
	}
	
	@Override
	public void addProperty(String subscriptLabel, ContextIntf context) {
		FutureProperties props ;
		
		if ((context!=null) && (context.contextIsComplete())){
			props = new FutureProperties();

			props.type = FutureProperties._CONTEXT;
			props.context = context;
			
			properties.add(props) ;
		}
	}


	@Override
	public void addProperty(String subscriptLabel, String[] values) {
		 
		addProperty( subscriptLabel, values, new String[]{}, 1.0) ;
	}


	@Override
	public void addProperty(String subscriptLabel, String[] features, double[] values, double minimalmatch) {
	 
		FutureProperties props ;
		
		props = new FutureProperties();
		 
		props.type = FutureProperties._VECTOR ;
		
		props.key  = "features";
		props.name = subscriptLabel;
		
		props.values = features;
		props.dataValues = values;
		props.minimalMatch = minimalmatch;

		properties.add(props) ;
	}


	@Override
	public void addProperty(	String subscriptLabel, 
								String[] features,
								double[] values, 
								String[] exclfeatures, 
								double minimalmatch,
								double minimalsimilarity) {

		FutureProperties props ;
		
		props = new FutureProperties();
		 
		props.type = FutureProperties._VECTOR ;
		
		props.key  = "features";
		props.name = subscriptLabel;
		props.values = features;
		props.exclvalues = exclfeatures;
		props.dataValues = values;
		props.minimalMatch = minimalmatch;
		props.minimalProfileSimilarity = minimalsimilarity;
		
		properties.add(props) ;
	}


	@Override
	public void addProperty( String subscriptLabel, String fulltext,
							 String[] exclitemvalues, double minimalMatch,
							 String textprocessorGUID) {
		
		FutureProperties props ;
		
		props = new FutureProperties();
		
		props.key  = "text";
		props.name = subscriptLabel;
		
		props.type = FutureProperties._FREETEXT ;
		props.fullText = fulltext;
		props.exclvalues = exclitemvalues ;
		
		// here we also may provide the ID of a region of the network, which then will be used to organize the routing
		props.processorGUID = textprocessorGUID ; // it will be a guid
		
		properties.add(props) ;
	}


	@Override
	public void addProperty(String subscriptLabel, byte[] imagebytes) {
		 
		FutureProperties props ;
		
		props = new FutureProperties() ;
		
		props.key  = "image";
		props.name = subscriptLabel;
		
		props.type = FutureProperties._IMAGE ;
		props.imageBytes = imagebytes ;
	}


	public ContextIntf getContext(){
	
		return (ContextIntf) new Context();	 	
	
	}


	@Override
	public void setGuid(String guidstr) {
		 
		guidStr = guidstr;
	}


	@Override
	public String getGuid() {
		 
		return guidStr;
	}


	@Override
	public void setInstanceID(long iid) {
		instanceID = iid;
	}


	@Override
	public long getInstanceID() {

		return instanceID;
	}


	@Override
	public void setDistanceControlProperties( DistanceControlProperties distancectrl) {
		 
		distanceCtrl = distancectrl ;
	}

 

 

 



 
	
}
